// component/add_shopdeil/add_shopdeil.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    name:'车载充电器',
    specid:'车载充电器车载充电器车载充电器',
    max_price:'1122',
    spnum: 1,
    goods_imgs: [
      { url: '/images/banner3.jpg' },
      { url: '/images/banner3.jpg' },
      { url: '/images/banner3.jpg' },
    ],
    aaa: { name: '规格1', specid: '5', stock: 0, max_price: '1000' },
    alltime: [
      { name: '规格1', stock: 0, specid: '51', max_price: '1000' },
      { name: '规格1', stock: 0, specid: '53', max_price: '2000' },
      { name: '规格1', stock: 0, specid: '25', max_price: '3000' },
      { name: '规格1', stock: 0, specid: '54', max_price: '4000' },
    ],
    configure: [
      { type: "车载类型", value: "车载充电器" },
      { type: "插口", value: "双口" },
      { type: "适用机型", value: "苹果手机，三星手机，华为手机，小米手机" },
      { type: "风格", value: "商务" },
      { type: "原装配件", value: "小米原装" },
      { type: "售后服务", value: "全国联保" },
      { type: "产地", value: "中国" },
      { type: "备注", value: "官方标配" },
      { type: "编号", value: "XP-11122333" }
    ],
    infor: [
      {
        max_price: '1122',
        name: '车载充电器',
        stock:'12'
      }
    ],
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //加入购物车
    showjrinfo: function () {
      var that = this;
      that.setData({
        isshow: true
      })
    },
    showjrshop: function () {
      var that = this;
      that.setData({
        isshop: true
      })
    },
    kshover: function (e) {
      let that = this;
      var list = that.data.alltime;
      var id = e.currentTarget.dataset.index;
      that.setData({
        id: id,
        aaa: that.data.alltime[id]
      })
    },
    addnum: function () {
      var spnum = this.data.spnum;
      spnum++;
      this.setData({
        spnum: spnum
      })
    },
    cannum: function () {
      var spnum = this.data.spnum;
      spnum--;
      if (spnum <= 0) {
        spnum = 1;
      }
      this.setData({
        spnum: spnum
      })
    },
    add_buy: function (e) {
      this.setData({
        isshop: false
      })
    },
    add_car: function (e) {
      this.setData({
        isshow: false
      })
    },
    tocloase: function () {
      this.setData({
        isshow: false
      })
    },
    toloasesjo: function () {
      this.setData({
        isshop: false
      })
    }
  }
})
